<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8"/>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=Edge">
    <meta name="viewport" content="target-densitydpi=640,width=1280,user-scalable=yes">
    <base href="<?php echo $system['siteRoot'];?>" />
    <title>商品列表</title>
    <?php import_tpl("fragment/icon.php"); ?>
    <link rel="stylesheet" href="plugin/reset.css"/>
    <link rel="stylesheet" href="plugin/awesome4/css/font-awesome.min.css"/>
    <link rel="stylesheet" href="style/common.css"/>
    <link rel="stylesheet" href="style/goods.css"/>
    <script src="plugin/jquery-1.11.2.min.js"></script>
    <script type="text/javascript">_root='<?php echo $system['siteRoot'];?>'</script>
    <script src="script/api.js"></script>
</head>
<body>
<div id="container" class="index">
    <?php import_part("custom.home","userBar"); ?>
    <?php import_part("custom.home","header"); ?>
    <?php import_tpl("fragment/nav.php"); ?>
    <div class="main-container">
        <div class="left">
            <div class="slide">
                <?php if(isset($r['categoryRoot'])&&!empty($r['categoryRoot'])) {?>
                    <a class="menu-normal js-menu-love" href="<?php e_page('goods','category',array('cat_id'=>$r['categoryRoot']['id'])) ?>"><?=$r['categoryRoot']['name']?><i class="fa fa-angle-right"></i></a>

                <?php }?>

                <?php if(isset($r['category'])&&!$r['is_bottom']){foreach ($r['category'] as $v) {?>
                    <a class="menu-label js-menu-1" href="<?php e_page('goods','category',array('cat_id'=>$v['id'])) ?>"><?=$v['name']?><i class="fa fa-angle-right"></i></a>
                <?php }}?>
            </div>
            <div class="qr-code-box">
                <img src="images/weixin.png" alt="扫描二维码关注" title="关注我们的微信"/>
                <div>
                    <p class="weixin">扫描二维码</p>
                    <p class="concern">关注我们的微信</p>
                </div>
            </div>
        </div>
        <div class="right">

            <div class="categro">
                <?php if(isset($r['cat'])){?>
                <p>
                    <a href="<?php e_page('goods','category',array('cat_id'=>0)) ?>">所有分类</a><i class="<?=$r['cat_id']!=0 ? 'fa fa-angle-right':'' ?>"></i>
                    <?php $count=count($r['cat']);
                    foreach ($r['cat'] as $k=>$v) {?>
                        <a href="<?php e_page('goods','category',array('cat_id'=>$v['id'])) ?>">
                            <?=$v['name']?></a><i class="<?= $k == $count-1?'':'fa fa-angle-right' ?>"></i>
                    <?php }?>
                </p>
                <?php }elseif(isset($r['pageTitle'])&&!empty($r['pageTitle'])) {?>
                    <p><?=$r['pageTitle']?></p>
                <?php }?>
            </div>
            <div class="order">
                <ul><?php
                    $up='fa fa-long-arrow-down';
                    $down='fa fa-long-arrow-up';
                    $i['base_price']=isset($r['base_price']) ? $r['base_price']?$up:$down :$up;
                    $a['base_price']=isset($r['base_price'])?!$r['base_price']:0;
                    $i['sale']=isset($r['sale'])? $r['sale']?$up:$down :$up;
                    $a['sale']=isset($r['sale'])?!$r['sale']:0;
                    $i['comment']=isset($r['comment'])?  $r['comment']?$up:$down  :$up;
                    $a['comment']=isset($r['comment'])?!$r['comment']:0;
                    ?>
                    <li><a href="<?php e_qus($r['paramRemain']) ?>">综合排序</a></li>
                    <li><a href="<?php e_qus($r['paramRemain']+array('orderBy'=>'base_price','asc'=>$a['base_price'])) ?>">
                            价格<i class="<?=$i['base_price']?>"></i></a></li>
                    <li><a href="<?php e_qus($r['paramRemain']+array('orderBy'=>'sale','asc'=>$a['sale'])) ?>">
                            销量<i class="<?=$i['sale']?>"></i></a></li>
                    <li><a href="<?php e_qus($r['paramRemain']+array('orderBy'=>'comment','asc'=>$a['comment'])) ?>">
                            评论<i class="<?=$i['comment']?>"></i></a></li>
                </ul>
            </div>
            <div class="goods-plate js-menu-love">
                <?php if(!empty($r['list'])){foreach ($r['list'] as $v) {
                    if(!empty($v)){?>
                    <div class="goods">
                        <div class="goods-pic-info">
                            <a href="<?php e_page('goods','index',array('id'=>$v['gopen_id']))?>"><img src="<?=$v['thumb']?>" alt=""/></a>
                            <a href="<?php e_page('goods','index',array('id'=>$v['gopen_id']))?>"><h4><?=$v['name']?></h4></a>
                        </div>
                        <div class="price"><?=$v['price']['base_price']?></div>
                        <div class="goods-cart js-goods-cart"><a href="<?php e_page('goods','index',array('id'=>$v['gopen_id']))?>">查看详情</a></div>
                    </div>
                <?php }}}?>
            </div>
        </div>
            <?php if($r['page'] instanceof Page && !$r['pageEmpty']){
                $page=$r['page'];?>
                <div class="turn-page">
                    <?php if($page->ifPrev()) { ?>
                        <a href="<?=$page->getPageUrl($page->getPrev());?>"><i class="fa fa-chevron-left"></i>上一页</a>
                    <?php }?>
                    <?php foreach($page->getPageArray() as $i){ ?>
                        <a href="<?=$page->getPageUrl($i);?>"><?php echo $i;?></a>
                    <?php } ?>
                    <?php if($page->ifNext()) { ?>
                        <a href="<?=$page->getPageUrl($page->getNext());?>">下一页<i class="fa fa-chevron-right"></i></a>
                    <?php }?>
                </div>
            <?php }else{echo '　　≥﹏≤ 找不到您要的信息哦~';} ?>

    </div>
    <?php import_tpl("fragment/footer.php"); ?>
</div>
</body>
</html>